package com.infindo.frame.util;

import android.view.animation.AccelerateInterpolator;
import android.view.animation.Animation;
import android.view.animation.TranslateAnimation;

public class AnimationUtil {

	private static final int durationTime = 500;
	
  /**  
   * In from Right
   * @return  
   */  
  public static Animation inFromRightAnimation() {  
      Animation inFromRight = new TranslateAnimation(  
              Animation.RELATIVE_TO_PARENT, +1.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f);  
      inFromRight.setDuration(durationTime);  
      inFromRight.setInterpolator(new AccelerateInterpolator());  
      return inFromRight;  
  }  
 
  /**  
   * Out from Left
   * @return  
   */  
  public static Animation outToLeftAnimation() {  
      Animation outtoLeft = new TranslateAnimation(  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, -1.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f);  
      outtoLeft.setDuration(durationTime);  
      outtoLeft.setInterpolator(new AccelerateInterpolator());  
      return outtoLeft;  
  }  
 
  /**  
   * In from Left
   * @return  
   */  
  public static Animation inFromLeftAnimation() {  
      Animation inFromLeft = new TranslateAnimation(  
              Animation.RELATIVE_TO_PARENT, -1.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f);  
      inFromLeft.setDuration(durationTime);  
      inFromLeft.setInterpolator(new AccelerateInterpolator());  
      return inFromLeft;  
  }  
  
  /**  
   * Out from Right
   * @return  
   */  
  public static  Animation outToRightAnimation() {  
      Animation outtoRight = new TranslateAnimation(  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, +1.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f,  
              Animation.RELATIVE_TO_PARENT, 0.0f);  
      outtoRight.setDuration(durationTime);  
      outtoRight.setInterpolator(new AccelerateInterpolator());  
      return outtoRight;  
  }

}
